//
//  CoworkQueueClient.h
//  CoworkQueue
//
//  Created by User on 2019/1/28.
//  Copyright © 2019 User. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger,CoworkQueueType){
    QUEUE_TYPE_QUEUE_STATUS = 1004,//排队状态
    QUEUE_TYPE_FAIL = 163,//加入队列失败
    QUEUE_TYPE_NOT_AGENT = 160,//无坐席
    QUEUE_TYPE_LEAVE_QUEUED = 159,//离开队列成功
    QUEUE_TYPE_LEAVE_QUEUE_FAIL = 164,//离开队列失败
    VIDEO_SERVER_START = 154,//开始视频
    MESSAGE_VIDEO_RESULT = 181,//视频结果
    QUEUE_TYPE_OTHER_ERROR = 162,//其它错误
    QUEUE_TYPE_CONNECT_ERROR = 161,//连接错误
    XMPP_RECONNECTED_ERROR = -1001,//xmpp重连错误
    XMPP_NETWORK_SHOCK = -1002//网络不稳
};

@protocol CoworkQueueClientDelegate <NSObject>

@optional
-(void)handleMessage:(CoworkQueueType)queueType
                   param:(NSDictionary *)param;
@end

@interface CoworkQueueClient : NSObject
/**
 ping间隔时间，默认5秒(单位：秒)
 */
@property (nonatomic,assign) NSTimeInterval pingInterval;
/**
 ping超时时间，默认5秒(单位：秒)
 */
@property (nonatomic,assign) NSTimeInterval pingTimeout;

/**
 排队对象

 @return 排队对象
 */
+(instancetype)shareInstance;


/**
 获取sdk版本号

 @return 版本号
 */
+(NSString *)version;


/**
 获取userid

 @return userid
 */
+(NSString *)getUserId;
/**
 设置代理

 @param delegate 排队代理
 */
-(void)registerMessageListener:(id<CoworkQueueClientDelegate>)delegate;

-(void)unRegisterMessageListener;
/**
 发起排队

 @param ip 排队地址
 @param port 排队端口
 @param queueParmas 排队参数
 */
-(void)joinQueueIp:(NSString *)ip
           withPort:(UInt16)port
    withQueueParmas:(NSDictionary *)queueParmas;

/**
 取消排队
 */
-(void)leaveQueue;

/**
 释放排队资源
 */
-(void)destroy;
/**
 * 是否开启控制台日志
 */
-(void)showLog:(BOOL)enabled;
@end

NS_ASSUME_NONNULL_END
